const app = getApp()
import { TARGET_TYPE } from '../../../constants/common';
import { navBack } from '../../../common/env';
import { createProductGroupModalMixin } from '../../../behaviors/product';

Page({
    mixins: [createProductGroupModalMixin],
    options: {
        pureDataPattern: /^_/, // 指定所有 _ 开头的数据字段为纯数据字段
    },
    data: {
        TARGET_TYPE,
        activityGroupId: null,
    },
    onLoad(options) {
        this.options = options || {}
        options.value && this.setData({
            activityGroupId: options.value
        })
    },
    onReady() {
        this.movableAreaCom = this.selectComponent('#productGroupMovableArea');
    },
    handleGroupChoose(e) {
        const { productGroupId } = e.detail
        this.setData({
            activityGroupId: productGroupId
        }, () => {
            app.event.trigger('productGroupActiveTabChange', productGroupId);
            navBack();
        })
    },
})
